#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from inary.actionsapi import shelltools
from inary.actionsapi import autotools
from inary.actionsapi import inarytools
from inary.actionsapi import get

def setup():
    autotools.autoreconf("-fvi")
    autotools.configure("""--prefix=/usr \
                --bindir=/bin \
                --sbindir=/sbin \
		--disable-account-tools-setuid \
                --with-libpam \
                --with-audit \
                --without-selinux \
                --disable-man \
		--without-group-name-max-length""")
    shelltools.system("sed -i '/selinux/d' etc/pam.d/*")

def build():
    # Force remove man pages building
    shelltools.system("rm -rf man ; mkdir man")
    f=open("man/Makefile","w")
    f.write("all:\n\n")
    f.write("build:\n\n")
    f.write("install:\n\n")
    f.flush()
    f.close()
    autotools.make()

def install():
    autotools.rawInstall("DESTDIR=%s" % get.installDIR())

    inarytools.dodoc("ChangeLog","README","NEWS")
